SCPI Command Structure and Syntax    Related Topics

SCPI commands consist of a so-called header and, in most cases, one or more parameters. The header and the parameters are separated by a "white space" (ASCII code 0 to 9, 11 to 32 decimal, e.g. blank). The headers may consist of several key words. Queries are formed by directly appending a question mark to the header.

Common commands and device-specific commands differ in their syntax.


Common Commands

Common (=device-independent) commands consist of a header preceded by an asterisk "*" and possibly one or more parameters.

Examples:

*RST

RESET, resets the instrument.

*ESE 253

EVENT STATUS ENABLE, sets the bits of the event status enable registers.

*ESR?

EVENT STATUS QUERY, queries the contents of the event status register.


Device-Specific Commands

Device-specific commands are of hierarchical structure. The different levels are represented by combined headers. Headers of the highest level (root level) have only one key word. This key word denotes a complete command system.

Example: 
SENSe     
This mnemonic denotes the command system SENSe.

For commands of lower levels, the complete path has to be specified, starting on the left with the highest level, the individual key words being separated by a colon ":".

Example: 
SENSe:FREQuency:STARt 1GHZ

This command is located on the third level of the SENSe system. It defines the start frequency of the sweep.

The following rules simplify and abbreviate the command syntax:


Structure of a Command Line

A command line may consist of one or several commands. It is terminated by a <New Line>, a <New Line> with EOI or an EOI together with the last data byte. Visual BASIC automatically produces an EOI together with the last data byte.

Several commands in a command line must be separated by a semicolon ";". If the next command belongs to a different command system, the semicolon is followed by a colon.

Example: CALL IBWRT(device%, "TRIGger:SOURce EXTernal;:SENSe:FREQuency:STARt 1GHZ") 

This command line contains two commands. The first command belongs to the TRIGger system and defines the trigger source (external trigger). The second command belongs to the SENSe system and defines the start frequency of the sweep.

If the successive commands belong to the same system, having one or several levels in common, the command line can be abbreviated. To this end, the second command after the semicolon starts with the level that lies below the common levels. The colon following the semicolon must be omitted in this case.

Example: CALL IBWRT(device%, "TRIG:SOUR EXT;:TRIG:TIM 0.1") 

This command line is represented in its full length and contains two commands separated from each other by the semicolon. Both commands are part of the TRIGger command system, i.e. they have one level in common.

When abbreviating the command line, the second command begins with the level below TRIG. The colon after the semicolon is omitted. The abbreviated form of the command line reads as follows:

CALL IBWRT(device%, "TRIG:SOUR EXT; TIM 0.1")

However, a new command line always begins with the complete path.

Example:

CALL IBWRT(device%, "TRIG:SOUR EXT ") 
CALL IBWRT(device%, "
TRIG:THR LOW ")


Responses to Queries

A query is defined for each setting command unless explicitly specified otherwise. It is formed by adding a question mark to the associated setting command. According to SCPI, the responses to queries are partly subject to stricter rules than in standard IEEE 488.2.

1. The requested parameter is transmitted without header.
Example:
TRIGger:SOURce? Response: IMM

2. Maximum values, minimum values and all further quantities which are requested via a special text parameter are returned as numerical values.
Example:
 
SENSe:FREQuency:STOP? MAX Response: 8000000000

3. Numerical values are output without their unit. The default unit for each command is reported in the SCPI command description.
Example:
 
SENSe:FREQuency:STOP? MAX Response: 8000000000 for 8 GHz

4. Boolean values are returned as 0 (for OFF) and 1 (for ON).
Example:
 
SWEep:TIME:AUTO? Response: 1

5. Text (character data) is returned in short form (see also next section).   
Example:
 TRIGger:SOURce? Response: IMM